/**
* @file rt_spp.h in RealTimeSpp
* @author rebeater
* @comment
* Create on 10/26/21 3:56 PM
* @version 1.0
**/

#ifndef REALTIMESPP__RT_SPP_H_
#define REALTIMESPP__RT_SPP_H_
#include <string>
#include "rtklib/rtklib.h"
using namespace std;
struct Position{
  double lat;
  double lon;
  double height;
   double std[3];
  int q;
  int ns;
};

typedef struct {                        /* signal index type */
  int n;                              /* number of index */
  int frq[MAXOBSTYPE];                /* signal frequency (1:L1,2:L2,...) */
  int pos[MAXOBSTYPE];                /* signal index in obs data (-1:no) */
  unsigned char pri[MAXOBSTYPE];     /* signal priority (15-0) */
  unsigned char type[MAXOBSTYPE];     /* type (0:C,1:L,2:D,3:S) */
  unsigned char code[MAXOBSTYPE];     /* obs code (CODE_L??) */
  double shift[MAXOBSTYPE];           /* phase shift (cycle) */
} sigind_t;

class RealTimeSpp{
 private:
  rtk_t rtk;
  prcopt_t prcopt_;
  obsd_t obsds[MAXOBS * 2];
  Position pos;
  nav_t nav_;
  obs_t obs_;
  int nobs;

  sigind_t index[7] = {{0}};

 public:
  	RealTimeSpp();
  	bool UpdateNav(const string &nav)/*TODO read Satellites info by real-time*/;
  	bool LoadNavFromRnx(const string &rnx_path);
  	bool Update(int week,double gpst,const char *buff);
  	bool GetSppPosition(Position *position);
};

#endif //REALTIMESPP__RT_SPP_H_
